[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
grapherrormsg() Return Error Message String
#include <graphics.h>
char far *far grapherrormsg(errcode); /* for huge model */
int errcode;
char *far grapherrormsg(errcode); /* for all other models*/
int errcode;
grapherrormsg() returns a pointer to a string associated with the
error code returned by graphresult() after an unsuccessful graphics
function call. grapherrormsg() can be used with printf() to print
out the error message, making programs more readable.
The following table lists the error message strings returned by
grapherrormsg(), along with the error codes returned by
graphresult():
Error 'graphics_errors'
code constant Error message string
0 grOk No error
-1 grNoInitGraph Graphics not installed
-2 grNotDetected Graphics hardware not detected
-3 grFileNotFound Device driver not found
-4 grInvalidDriver Invalid device driver file
-5 grNoLoadMem Insufficient memory to load driver
-6 grNoScanMem Out of memory in scan fill
-7 grNoFloodMem Out of memory in flood fill
-8 grFontNotFound Font file not found
-9 grNoFontMem Not enough memory to load font
-10 grInvalidMode Invalid mode for selected driver
-11 grError Graphics error
-12 grIOerror Graphics I/O error
-13 grInvalidFont Invalid font file
-14 grInvalidFontNum Invalid font number
-15 grInvalidDeviceNum Invalid device number
Returns: A pointer to a string associated with the error code
returned by graphresult().
-------------------------------- Example ---------------------------------
The following statements initialize the graphics system and print an
error message on error.
#include <graphics.h>
#include <conio.h>
int gdriver = DETECT;
int gmode;
int errslt;
main()
{
initgraph(&gdriver,&gmode,"");
errslt = graphresult();
if (errslt < 0 )
printf("Error #%d, %s\n",errslt,grapherrormsg(errslt));
getch();
.
.
/* graphics operations */
.
.
closegraph();
}
See Also:
graphresult()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson